package com.wrial.offer;
/*
 * @Author  Wrial
 * @Date Created in 20:54 2020/4/1
 * @Description 数组中重复的数字
 */

import java.util.HashSet;
import java.util.Set;

public class FaceTest_03 {

    public int findRepeatNumber(int[] nums) {
        int repeatNum = -1;
        Set<Integer> set = new HashSet<>();

        for (int num : nums) {
            if (!set.add(num)){
                repeatNum = num;
                break;

            }

        }
        return repeatNum;

    }

    public static void main(String[] args) {
        Set<Integer> set = new HashSet<>();
        set.add(1);
    }

}
